module(..., package.seeall) -- 使得文件中的函数在何处都可调用

require "sys"
require "rtos"

local function storageSmallerAndRestart()
    if collectgarbage("count")<567 then
        local collectCount = 0
        while collectCount <5 do
            collectgarbage("collect")
            collectCount=collectCount+1
        end
        if collectgarbage("count")<567 then
            sys.restart("内存不足设备重启！")
        end
    end
    if rtos.get_fs_free_size() < 921600 then
        sys.restart("文件系统空间不足设备重启！")
    end
end
local function storageCheckTimerLoop()
    sys.timerLoopStart(storageSmallerAndRestart,300000)
end
storageCheckTimerLoop()
